/*
 * A Gneral purpose java based Genome Library created by Susanta Tewari.
 * Copyright is protected. Contact Susanta Tewari at <statsusant@yahoo.com>
 */

package genomemap.tagging;

import genomemap.data.Clone;
import genomemap.data.Gene;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Susanta Tewari <stewari@yahoo.com>
 */
public class Tagger {

    /** Field description */
    private final List<TaggingStrategy> taggingStrategyList = new ArrayList<>();

    /** Field description */
    private final Gene[] genes;

    /** Field description */
    private final Clone[] clones;

    /**
     * Constructs ...
     *
     * @param genes description
     * @param clones description
     */
    public Tagger(Gene[] genes, Clone[] clones) {

        this.genes  = genes;
        this.clones = clones;
    }

    public void tag() {

        for (TaggingStrategy taggingStrategie : taggingStrategyList) {

            taggingStrategie.tag();
        }
    }

    public Clone[] getClones() {
        return clones;
    }

    public Gene[] getGenes() {
        return genes;
    }

    public boolean addTaggingStrategy(TaggingStrategy taggingStrategie) {

        taggingStrategie.setTagger(this);

        return taggingStrategyList.add(taggingStrategie);
    }

    public int getTotalClonesTagged() {

        int count = 0;

        for (Clone clone : clones) {

            if (clone.isTagged()) {
                count++;
            }
        }

        return count;
    }

    public int getTotalGenesTagged() {

        int count = 0;

        for (Gene gene : genes) {

            if (gene.isTagged()) {
                count++;
            }
        }

        return count;
    }
}
